
<form method="post" action="/oss/?r=broadcast/doAdd">
    <{include file='../common_params.tpl'}>

    <div class="box box-black">
        <div class="box-body">
            <table class="table table-bordered">
                <colgroup>
                    <col style="width: 20%;"></col>
                    <col style="width: 80%;"></col>
                </colgroup>

                <!--<tr>
                    <th class="th-label">服务器</th>
                    <td>
                        <select class="form-control" name="server">
                        	<{foreach from=$serverList item=item key=key}>
                        		<option value="<{$key}>-<{$item}>"><{$item}></option>
                        	<{/foreach}>
                        </select>
                    </td>
                </tr>-->

                <tr>
                    <th class="th-label">消息类型</th>
                    <td>
                        <{foreach from=$typeList item=item key=key}>
                        <label><input type="checkbox" name="type[]" <{if $key == '3'}>checked<{/if}> value="<{$key}>" /><{$item}></label>
                        <{/foreach}>
                    </td>
                </tr>

                <tr>
                    <th class="th-label">消息内容</th>
                    <td>
                        <textarea class="form-control" rows="5" name="content"></textarea>
                    </td>
                </tr>
<!--
                <tr>
                    <th class="th-label">循环类型</th>
                    <td>
                        <select id="sel-end-type" class="form-control inline" name="end_type">
                            <option value="1">按时间循环</option>
                            <option value="2">按次数循环</option>
                            <option value="3">不循环</option>
                        </select>
                    </td>
                </tr>
-->
                <tr>
                    <th class="th-label">开始时间</th>
                    <td>
                        <input type="text" name="start_time" class="form-control inline time" />
                        <span class="description">不填为不限</span>
                    </td>
                </tr>

                <tr class="end-by-time">
                    <th class="th-label">结束时间</th>
                    <td>
                        <input type="text" name="end_time" class="form-control inline time" />
                        <span class="description">不填为不限</span>
                    </td>
                </tr>

                <tr class="end-by-num">
                    <th class="th-label">次数</th>
                    <td>
                    	<input type="number" min="1" name="number" value="1" class="form-control inline" />
                        <span class="description">多少次</span>
                    </td>   
                </tr>

                <tr class="end-by-num end-by-time">
                    <th class="th-label">间隔时间</th>
                    <td>
                        <input type="number" min="1" name="frequency" class="form-control inline" value="30" />
                        <span class="description">单位为秒，必须大于0</span>
                    </td>
                </tr>

                <!--<tr class="end-by-num end-by-time">
                    <th class="th-label">广播次数</th>
                    <td>
                        <input type="text" name="times" class="form-control inline" value="3" />
                    </td>
                </tr>-->
            </table>
        </div>

        <div class="box-footer">
            <a href="javascript:history.go(-1);" class="btn btn-default">返回</a>
            <button type="submit" class="btn btn-default pull-right">保存</button>
        </div>
    </div>
</form>

<script>
    $(function(){
        $(".time").datetimepicker({
            format: 'yyyy-mm-dd hh:ii:00',
        });

        $("#sel-end-type").change(function(){
            var val = $(this).val();
            if(val == 1) {
                $(".end-by-num").hide();
                $(".end-by-time").show();
            }else if (val == 2) {
                $(".end-by-time").hide();
                $(".end-by-num").show();
            }else if (val == 3) {
                $(".end-by-time,.end-by-num").hide();
            }
        }).change();
    });
</script>
